home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / extras / Direct3D / Tools / 3DSMax4 / dllentry.cpp next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  2.3 KB  |  76 lines

  1. //-----------------------------------------------------------------------------
  2. // File: DllEntry.cpp
  3. //
  4. // Desc: Contains the Dll Entry stuff
  5. //
  6. // Copyright (C) 1998-2000 Microsoft Corporation. All Rights Reserved.
  7. //-----------------------------------------------------------------------------
  8.  
  9. #include "pch.h"
  10. #include "xskinexp.h"
  11.  
  12. extern ClassDesc* GetXSkinExpDesc();
  13.  
  14. HINSTANCE g_hInstance;
  15. int controlsInit = FALSE;
  16.  
  17. // This function is called by Windows when the DLL is loaded.  This 
  18. // function may also be called many times during time critical operations
  19. // like rendering.  Therefore developers need to be careful what they
  20. // do inside this function.  In the code below, note how after the DLL is
  21. // loaded the first time only a few statements are executed.
  22.  
  23. BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
  24. {
  25.     g_hInstance = hinstDLL;                // Hang on to this DLL's instance handle.
  26.  
  27.     if (!controlsInit) {
  28.         controlsInit = TRUE;
  29.         InitCustomControls(g_hInstance);    // Initialize MAX's custom controls
  30.         InitCommonControls();            // Initialize Win95 controls
  31.     }
  32.             
  33.     return (TRUE);
  34. }
  35.  
  36. // This function returns a string that describes the DLL and where the user
  37. // could purchase the DLL if they don't have it.
  38. __declspec( dllexport ) const TCHAR* LibDescription()
  39. {
  40.     return GetString(IDS_LIBDESCRIPTION);
  41. }
  42.  
  43. // This function returns the number of plug-in classes this DLL
  44. //TODO: Must change this number when adding a new class
  45. __declspec( dllexport ) int LibNumberClasses()
  46. {
  47.     return 1;
  48. }
  49.  
  50. // This function returns the number of plug-in classes this DLL
  51. __declspec( dllexport ) ClassDesc* LibClassDesc(int i)
  52. {
  53.     switch(i) {
  54.         case 0: return GetXSkinExpDesc();
  55.         default: return 0;
  56.     }
  57. }
  58.  
  59. // This function returns a pre-defined constant indicating the version of 
  60. // the system under which it was compiled.  It is used to allow the system
  61. // to catch obsolete DLLs.
  62. __declspec( dllexport ) ULONG LibVersion()
  63. {
  64.     return VERSION_3DSMAX;
  65. }
  66.  
  67. TCHAR *GetString(int id)
  68. {
  69.     static TCHAR buf[256];
  70.  
  71.     if (g_hInstance)
  72.         return LoadString(g_hInstance, id, buf, sizeof(buf)) ? buf : NULL;
  73.     return NULL;
  74. }
  75.  
  76.